from django.db import models


class AuthCategory(models.Model):
    '''权限类别'''
    name = models.CharField('权限类别名', max_length=50, unique=True, help_text='权限类别名')

    class Meta:
        db_table = 'tb_u_auth_category'
        verbose_name = '权限类别'
        verbose_name_plural = verbose_name


class Auth(models.Model):
    '''权限'''
    METHOD_CHOICES = (
        ('GET', 'GET'),
        ('POST', 'POST'),
        ('PUT', 'PUT'),
        ('PATCH', 'PATCH'),
        ('DELETE', 'DELETE')
    )

    METHOD_ENUM = {
        1: 'GET',
        2: 'POST',
        3: 'PUT',
        4: 'PATCH',
        5: 'DELETE'
    }

    title = models.CharField('权限名', max_length=50, unique=True, help_text='权限名')
    description = models.CharField('权限描述', max_length=250, default='', blank=True, help_text='权限描述')
    method = models.CharField('请求方式', choices=METHOD_CHOICES, help_text='请求方式', max_length=20)
    url = models.CharField('URL', max_length=100, help_text='URL')
    category = models.ForeignKey(AuthCategory, on_delete=models.CASCADE, verbose_name='权限分类', help_text='权限分类')

    class Meta:
        db_table = 'tb_u_auth'
        verbose_name = '权限'
        verbose_name_plural = verbose_name
        unique_together = ('method', 'url')


class Role(models.Model):
    '''角色'''

    VISIBLE_CHOICES = (
        (1, "可见"),
        (2, "不可见")
    )

    IS_ADMIN_CHOICES = (
        (1, '是'),
        (2, '否')
    )

    name = models.CharField(verbose_name='角色名', max_length=30, unique=True)
    description = models.CharField(verbose_name='角色描述', max_length=250, default='', blank=True)
    auth = models.ManyToManyField(Auth, verbose_name='权限', blank=True,)
    visible = models.SmallIntegerField(choices=VISIBLE_CHOICES, default=1)
    is_admin = models.SmallIntegerField(choices=IS_ADMIN_CHOICES, default=2)

    class Meta:
        db_table = 'tb_u_role'
        verbose_name = '角色'
        verbose_name_plural = verbose_name


class Level(models.Model):
    '''层级表'''

    IS_FIRST_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    name = models.CharField('层级名', max_length=64)
    description = models.CharField('层级描述', max_length=250, default='', blank=True)
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='父层级', related_name="subs")
    level = models.IntegerField(verbose_name='等级', null=True, blank=True)
    account = models.CharField(verbose_name='层级', null=True, blank=True, max_length=32)
    account_nine = models.CharField(verbose_name='层级', null=True, blank=True, max_length=32)
    orgId = models.CharField(verbose_name='权益id', max_length=32, null=True, blank=True)
    prov = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='省', related_name="prov_subs")
    city = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='市', related_name="city_subs")
    district = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='区县', related_name="district_subs")
    branch = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='网点', related_name="branch_subs")
    prov_name = models.CharField(verbose_name='省', max_length=64, null=True, blank=True)
    city_name = models.CharField(verbose_name='市', max_length=64, null=True, blank=True)
    district_name = models.CharField(verbose_name='区县', max_length=64, null=True, blank=True)
    branch_name = models.CharField(verbose_name='网点', max_length=64, null=True, blank=True)
    point = models.DecimalField(verbose_name='邮米', max_digits=10, decimal_places=0, default=0)
    acceptId = models.CharField(verbose_name='上级id', max_length=32, null=True, blank=True)
    longitude = models.CharField(verbose_name='经度', max_length=32, null=True, blank=True)
    latitude = models.CharField(verbose_name='纬度', max_length=32, null=True, blank=True)
    address = models.CharField(max_length=100, verbose_name='地址', null=True, blank=True)
    address_title = models.CharField(max_length=20, verbose_name='地址名称', null=True, blank=True)
    telephone = models.CharField(max_length=20, verbose_name='固定电话', null=True, blank=True)
    work_time = models.CharField(max_length=64, verbose_name='营业时间', null=True, blank=True)
    shop_url = models.CharField(verbose_name='商城链接', null=True, blank=True, max_length=128)
    shop_qrcode = models.ImageField(verbose_name='商城链接', null=True, blank=True)
    longitude_begin = models.CharField(verbose_name='经度(起)', max_length=32, null=True, blank=True)
    longitude_end = models.CharField(verbose_name='经度(止)', max_length=32, null=True, blank=True)
    latitude_begin = models.CharField(verbose_name='纬度(起)', max_length=32, null=True, blank=True)
    latitude_end = models.CharField(verbose_name='纬度(止)', max_length=32, null=True, blank=True)

    class Meta:
        db_table = 'tb_u_level'
        verbose_name = '层级'
        verbose_name_plural = verbose_name


class OldWYHLevel(models.Model):
    '''旧平台微邮惠层级'''

    province = models.CharField(verbose_name='省', max_length=16)
    city = models.CharField(verbose_name='省', max_length=16)
    district = models.CharField(verbose_name='省', max_length=16)
    branch = models.CharField(verbose_name='省', max_length=16)
    name = models.CharField(verbose_name='层级', max_length=64, null=True, blank=True)
    level = models.ForeignKey('users.Level', on_delete=models.SET_NULL, verbose_name='层级', null=True, blank=True)

    class Meta:
        db_table = 'tb_u_old_wyhlevel'
        verbose_name = '层级'
        verbose_name_plural = verbose_name


class User(models.Model):
    '''用户'''

    IS_ACTIVE_CHOICES = (
        (0, '离岗'),
        (1, '在岗')
    )

    PLATFORM_CHOICES = (
        (1, '非广州'),
        (2, '广州')
    )

    IS_DEVELOPER_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_AGREEMENT_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    username = models.CharField(max_length=32, verbose_name='用户名')
    mobile = models.CharField(max_length=11, verbose_name='手机号', unique=True)
    role = models.ForeignKey('users.Role', on_delete=models.CASCADE, verbose_name='角色')
    header = models.ImageField(verbose_name='头像', default='header.png')
    nickname = models.CharField(verbose_name='姓名', max_length=20, blank=True, null=True)
    level = models.ForeignKey('users.Level', on_delete=models.SET_NULL, verbose_name='层级', null=True, blank=True)
    is_active = models.SmallIntegerField(verbose_name='状态', choices=IS_ACTIVE_CHOICES, default=1)
    account = models.CharField(verbose_name='客户经理账号', max_length=32, null=True, blank=True)
    remark = models.CharField(verbose_name='备注', max_length=64, null=True, blank=True)
    platform = models.SmallIntegerField(verbose_name='平台', choices=PLATFORM_CHOICES, default=1, blank=True)
    OrgId = models.CharField(verbose_name='所属机构', max_length=32, null=True, blank=True)
    create_time = models.DateTimeField(verbose_name='注册时间')
    wyh_id = models.CharField(verbose_name='平台id', max_length=20, null=True, blank=True)
    distributed_point = models.DecimalField(verbose_name='派发邮米', max_digits=10, decimal_places=0, default=0)
    distributed_point_num = models.DecimalField(verbose_name='派发邮米次数', max_digits=10, decimal_places=0, default=0)
    avatar = models.CharField(verbose_name='头像', max_length=256, null=True, blank=True)
    openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    create_user = models.ForeignKey('self', verbose_name='添加人', on_delete=models.SET_NULL, null=True, blank=True)
    invite_url = models.CharField(verbose_name='邀请链接', null=True, blank=True, max_length=128)
    invite_qrcode = models.ImageField(verbose_name='邀请链接', null=True, blank=True)
    identify = models.CharField(verbose_name='身份标识', max_length=64, null=True, blank=True)
    authen_key = models.CharField(verbose_name='认证密钥', max_length=32, null=True, blank=True)
    public_key = models.TextField(verbose_name='签名公钥', null=True, blank=True)
    private_key = models.TextField(verbose_name='签名私钥', null=True, blank=True)
    is_developer = models.SmallIntegerField(verbose_name='是否开发者', choices=IS_DEVELOPER_CHOICES, default=0)
    is_agreement = models.SmallIntegerField(verbose_name='是否签名', choices=IS_AGREEMENT_CHOICES, default=0)
    signature = models.ImageField(verbose_name='签名', null=True, blank=True)
    contract = models.ImageField(verbose_name='协议', null=True, blank=True)
    sign_time = models.DateTimeField(verbose_name='签名时间', null=True, blank=True)

    class Meta:
        db_table = 'tb_u_user'
        verbose_name = '用户'
        verbose_name_plural = verbose_name


class CustomerUser(models.Model):
    '''C端用户'''

    IS_DISTRIBUTOR_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_OFFLINE_CHOICES = (
        (0, '线上'),
        (1, '线下')
    )

    IS_AUTH_CHOICES = (
        (1, '未认证'),
        (2, '已认证')
    )

    IS_PSBC_CARD_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IDENTIFICATION_TYPE_CHOICES = (
        (1, '身份证（限中国大陆居民)'),
        (2, '护照（限境外人士)'),
        (3, '中国香港居民-来往内地通行证'),
        (4, '中国澳门居民-来往内地通行证'),
        (5, '中国台湾居民-来往大陆通行证'),
        (6, '外国人居留证'),
        (7, '港澳居民证'),
        (8, '台湾居民证')
    )

    username = models.CharField(max_length=32, verbose_name='用户名', null=True, blank=True)
    old_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    new_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    wyh_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    unionid = models.CharField(verbose_name='unionid', max_length=32, null=True, blank=True)
    address = models.CharField(verbose_name='地址', max_length=256, null=True, blank=True)
    mobile = models.CharField(max_length=11, verbose_name='手机号', unique=True)
    idcode = models.CharField(verbose_name='身份证', max_length=18, null=True, blank=True)
    level = models.ForeignKey('users.Level', on_delete=models.SET_NULL, verbose_name='层级', null=True, blank=True)
    realname = models.CharField(max_length=32, verbose_name='真实姓名', null=True, blank=True)
    is_offline = models.SmallIntegerField(verbose_name='注册类型', choices=IS_OFFLINE_CHOICES, null=True, blank=True)
    is_distributor = models.SmallIntegerField(verbose_name='是否客户经理添加', choices=IS_DISTRIBUTOR_CHOICES, null=True, blank=True)
    point = models.DecimalField(verbose_name='邮米', max_digits=10, decimal_places=0, default=0)
    obtain_point = models.DecimalField(verbose_name='获得邮米', max_digits=10, decimal_places=0, default=0)
    use_point = models.DecimalField(verbose_name='使用邮米', max_digits=10, decimal_places=0, default=0)
    order_num = models.IntegerField(verbose_name='邮米下单数', default=0)
    avatar = models.CharField(verbose_name='头像', max_length=256, null=True, blank=True)
    create_time = models.DateTimeField(verbose_name='注册时间')
    user = models.ForeignKey('users.User', verbose_name='邀请客户经理', on_delete=models.SET_NULL, null=True, blank=True)
    ali_user_id = models.CharField(verbose_name='user_id', max_length=32, null=True, blank=True)
    is_auth = models.SmallIntegerField(verbose_name='是否认证', choices=IS_AUTH_CHOICES, default=1, blank=True)
    identification_front_copy = models.ImageField(verbose_name='证件正面照片', null=True, blank=True)
    is_psbc_card = models.SmallIntegerField(verbose_name='是否绑定邮储卡', choices=IS_PSBC_CARD_CHOICES, default=0)
    identification_type = models.SmallIntegerField(verbose_name='法人证件类型', choices=IDENTIFICATION_TYPE_CHOICES, null=True, blank=True)

    class Meta:
        db_table = 'tb_u_customer_user'
        verbose_name = 'C端用户'
        verbose_name_plural = verbose_name


class CustomerUserVice(models.Model):
    '''C端用户附表'''

    IS_PSBC_CARD_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_BIND_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_MOBILE_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_AUTH_CHOICES = (
        (1, '未认证'),
        (2, '已认证')
    )

    IS_SUBSCRIBE_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_WYH_CUSTOMER_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_FIRST_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_AGREEMENT_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IDENTIFICATION_TYPE_CHOICES = (
        (1, '身份证（限中国大陆居民)'),
        (2, '护照（限境外人士)'),
        (3, '中国香港居民-来往内地通行证'),
        (4, '中国澳门居民-来往内地通行证'),
        (5, '中国台湾居民-来往大陆通行证'),
        (6, '外国人居留证'),
        (7, '港澳居民证'),
        (8, '台湾居民证')
    )

    wyf_gzh_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    unionid = models.CharField(verbose_name='unionid', max_length=32, unique=True)
    wyh_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    point = models.DecimalField(verbose_name='积分', max_digits=10, decimal_places=2, default=0)
    obtain_point = models.DecimalField(verbose_name='获得积分', max_digits=10, decimal_places=2, default=0)
    use_point = models.DecimalField(verbose_name='使用积分', max_digits=10, decimal_places=2, default=0)
    is_bind = models.SmallIntegerField(verbose_name='是否绑定', choices=IS_BIND_CHOICES, default=0)
    is_psbc_card = models.SmallIntegerField(verbose_name='是否绑定邮储卡', choices=IS_PSBC_CARD_CHOICES, default=0)
    is_mobile = models.SmallIntegerField(verbose_name='是否关联手机号', choices=IS_MOBILE_CHOICES, default=0)
    customeruser = models.OneToOneField('users.CustomerUser', verbose_name='C端用户', on_delete=models.SET_NULL, null=True, blank=True)
    mobile = models.CharField(max_length=11, verbose_name='手机号', null=True, blank=True)
    avatar = models.CharField(verbose_name='头像', max_length=256, null=True, blank=True)
    username = models.CharField(max_length=32, verbose_name='用户名', null=True, blank=True)
    realname = models.CharField(max_length=32, verbose_name='真实姓名', null=True, blank=True)
    identification_front_copy = models.ImageField(verbose_name='证件正面照片', null=True, blank=True)
    idcode = models.CharField(verbose_name='身份证', max_length=18, null=True, blank=True)
    is_auth = models.SmallIntegerField(verbose_name='是否认证', choices=IS_AUTH_CHOICES, default=1)
    province = models.CharField(max_length=16, verbose_name='手机号归属', null=True, blank=True)
    city = models.CharField(max_length=16, verbose_name='手机号归属', null=True, blank=True)
    operator = models.CharField(max_length=16, verbose_name='手机号类型', null=True, blank=True)
    is_subscribe = models.SmallIntegerField(verbose_name='是否关注', choices=IS_PSBC_CARD_CHOICES, default=0)
    create_time = models.DateTimeField(verbose_name='添加时间', null=True, blank=True)
    is_wyh_customer = models.SmallIntegerField(verbose_name='是否微邮惠商圈用户', choices=IS_WYH_CUSTOMER_CHOICES, default=1)
    level = models.ForeignKey('users.Level', on_delete=models.SET_NULL, verbose_name='层级', null=True, blank=True)
    inviter = models.ForeignKey('self', verbose_name='邀请人', on_delete=models.SET_NULL, null=True, blank=True)
    is_first = models.SmallIntegerField(verbose_name='是否首次登录', choices=IS_FIRST_CHOICES, default=1)
    inviter_qrcode = models.ImageField(verbose_name='邀请码', null=True, blank=True)
    inviter_time = models.DateTimeField(verbose_name='受邀请时间', null=True, blank=True)
    is_agreement = models.SmallIntegerField(verbose_name='是否同意', choices=IS_AGREEMENT_CHOICES, default=0)
    ylx_openid = models.CharField(verbose_name='openid', max_length=32, null=True, blank=True)
    update_time = models.DateTimeField(verbose_name='更新资料时间', null=True, blank=True)
    identification_type = models.SmallIntegerField(verbose_name='法人证件类型', choices=IDENTIFICATION_TYPE_CHOICES, null=True, blank=True)

    class Meta:
        db_table = 'tb_u_customer_user_vice'
        verbose_name = 'C端用户'
        verbose_name_plural = verbose_name


class CustomerUserViceInviterRecord(models.Model):

    IS_INVITER_CHOICES = (
        (0, '未验卡'),
        (1, '已验卡')
    )

    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE, related_name='c_name')
    inviter = models.ForeignKey('users.CustomerUserVice', verbose_name='邀请人', on_delete=models.SET_NULL, null=True, blank=True, related_name='i_name')
    inviter_time = models.DateTimeField(verbose_name='受邀请时间', null=True, blank=True)
    create_time = models.DateTimeField(verbose_name='扫码时间', auto_now_add=True)
    is_inviter = models.SmallIntegerField(verbose_name='是否验卡', choices=IS_INVITER_CHOICES, default=0)
    qrcode = models.ForeignKey('merchants.MerchantBusinessQRCode', verbose_name='商圈码', on_delete=models.CASCADE)

    class Meta:
        db_table = 'tb_u_customer_user_vice_inviter_recode'
        verbose_name = 'C端用户邀请记录'
        verbose_name_plural = verbose_name


class CustomerUserViceArea(models.Model):

    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE)
    level = models.ForeignKey('users.Level', on_delete=models.SET_NULL, verbose_name='层级', null=True, blank=True)

    class Meta:
        db_table = 'tb_u_customer_user_vice_area'
        verbose_name = 'C端用户活动区域标签'
        verbose_name_plural = verbose_name


class CustomerUserViceBankType(models.Model):

    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE)
    bank_code = models.CharField(verbose_name='字符型银行编码', max_length=32, null=True, blank=True)

    class Meta:
        db_table = 'tb_u_customer_user_vice_bank_type'
        verbose_name = 'C端用户支付习惯标签'
        verbose_name_plural = verbose_name


class CustomerUserViceTime(models.Model):

    ACTION_TIME_CHOICES = (
        (1, '7点到9点'),
        (2, '9点到12点'),
        (3, '12点到14点'),
        (4, '14点到18点'),
        (5, '18点到22点'),
        (6, '22点到凌晨2点')
    )

    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE)
    action_time = models.SmallIntegerField(verbose_name='活跃时间', choices=ACTION_TIME_CHOICES)

    class Meta:
        db_table = 'tb_u_customer_user_vice_time'
        verbose_name = 'C端用户活跃时间标签'
        verbose_name_plural = verbose_name


class CustomerUserViceRelation(models.Model):

    customeruser = models.ForeignKey('users.CustomerUser', verbose_name='C端用户', on_delete=models.CASCADE)
    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE)

    class Meta:
        db_table = 'tb_u_customer_user_vice_relation'
        verbose_name = 'C端用户关联'
        verbose_name_plural = verbose_name


class ManagerCustomerRelation(models.Model):
    '''客户经理与客户关联表'''

    manager = models.ForeignKey('users.User', verbose_name='邀请客户经理', on_delete=models.CASCADE)
    customer = models.ForeignKey('users.CustomerUser', verbose_name='客户', on_delete=models.CASCADE)
    create_time = models.DateTimeField(verbose_name='关联时间', auto_now_add=True)

    class Meta:
        db_table = 'tb_u_manager_customer_relation'
        verbose_name = '客户经理与客户关联表'
        verbose_name_plural = verbose_name


class CustomerUserAddress(models.Model):
    """用户地址"""

    IS_DELETED_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_DEFAULT_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    customeruser = models.ForeignKey(CustomerUser, on_delete=models.CASCADE, related_name='addresses', verbose_name='用户')
    title = models.CharField(max_length=20, verbose_name='地址名称', null=True, blank=True)
    receiver = models.CharField(max_length=20, verbose_name='收货人')
    province  = models.CharField(max_length=20, verbose_name='省')
    city = models.CharField(max_length=20, verbose_name='市')
    district = models.CharField(max_length=20, verbose_name='区')
    place = models.CharField(max_length=50, verbose_name='地址')
    mobile = models.CharField(max_length=11, verbose_name='手机')
    longitude = models.CharField(verbose_name='经度', max_length=32, null=True, blank=True)
    latitude = models.CharField(verbose_name='纬度', max_length=32, null=True, blank=True)
    is_deleted = models.SmallIntegerField(verbose_name='逻辑删除', choices=IS_DELETED_CHOICES, default=0, blank=True)
    is_default = models.SmallIntegerField(verbose_name='是否默认', choices=IS_DEFAULT_CHOICES, default=0, blank=True)
    create_time = models.DateTimeField(verbose_name='添加时间', null=True, blank=True)

    class Meta:
        db_table = 'tb_u_customer_user_address'
        verbose_name = '用户地址'
        verbose_name_plural = verbose_name


class CustomerUserViceAddress(models.Model):
    """用户地址"""

    IS_DELETED_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    IS_DEFAULT_CHOICES = (
        (0, '否'),
        (1, '是')
    )

    SEX_CHOICES = (
        (0, '女士'),
        (1, '先生')
    )

    customeruservice = models.ForeignKey('users.CustomerUserVice', verbose_name='领取用户', on_delete=models.CASCADE)
    title = models.CharField(max_length=20, verbose_name='地址名称', null=True, blank=True)
    receiver = models.CharField(max_length=20, verbose_name='收货人')
    province  = models.CharField(max_length=20, verbose_name='省')
    city = models.CharField(max_length=20, verbose_name='市')
    district = models.CharField(max_length=20, verbose_name='区')
    place = models.CharField(max_length=50, verbose_name='地址')
    mobile = models.CharField(max_length=11, verbose_name='手机')
    longitude = models.CharField(verbose_name='经度', max_length=32, null=True, blank=True)
    latitude = models.CharField(verbose_name='纬度', max_length=32, null=True, blank=True)
    is_deleted = models.SmallIntegerField(verbose_name='逻辑删除', choices=IS_DELETED_CHOICES, default=0, blank=True)
    is_default = models.SmallIntegerField(verbose_name='是否默认', choices=IS_DEFAULT_CHOICES, default=0, blank=True)
    create_time = models.DateTimeField(verbose_name='添加时间', null=True, blank=True)
    sex = models.SmallIntegerField(verbose_name='性别', choices=SEX_CHOICES, default=1)

    class Meta:
        db_table = 'tb_u_customer_user_vice_address'
        verbose_name = '用户地址'
        verbose_name_plural = verbose_name


# class CustomerUserVicePointAttachedTable(models.Model):
#     '''商圈用户邮米'''
#
#     mobile = models.CharField(max_length=11, verbose_name='手机号', unique=True)
#     point = models.DecimalField(verbose_name='积分', max_digits=10, decimal_places=2, default=0)
#     customeruservice = models.OneToOneField('users.CustomerUserVice', verbose_name='关联商圈用户', on_delete=models.CASCADE)
#
#     class Meta:
#         db_table = 'tb_u_customer_user_vice_point_attached_table'
#         verbose_name = '用户地址'
#         verbose_name_plural = verbose_name